pmsd
and qmsd
implement exact (for even n
) or approximate (odd n
) probabilities
and quantiles for the median scaled difference applied to a single observation in a normal
distribution. n
is the number of observations in the data set of interest and not the degrees of
freedom or number of differences (msd for a value x[i] in a set of n
observations
involves n-1
scaled differences).
The probabilities are calculated using quadrature integration over a distribution of an order
statistic, and may be quite slow (seconds for a vector of several hundred 100 values of q on an
Intel x86 machine running at 1GHz). qmsd
is obtained even more slowly by root-finding
from pmsd
using uniroot
.
Note that both functions are appropriate for the distribution of single values. If
seeking an outlier test, adjust p
for n
comparisons before applying qmsd
.